<?php
class publicAction extends Action
{
        public function __construct() {
           $whereMap=array('state'=>'active');
           $this->leftbar=D('forum')->where($whereMap)->select();
        }
	public function verify()
	{
            import('ORG.Util.Image');
            Image::buildImageVerify(4,3,gif,70,30);
	}
	
	/*Public function verify(){//中文验证码
	     import("ORG.Util.Image");
	     Image::GBVerify();
	}*/
       public function getForumBypostId($forum_id){
            $whereMap=array('id'=>$forum_id);
            $forumInfo=D('forum')->where($whereMap)->find();
            if($forumInfo){
                return $forumInfo; 
            }
        }
        public function getUserById($user_id){
            $whereMap=array('id'=>$user_id);
            $user=D('user')->where($whereMap)->find();
            if($user){
               return $user;
            }else{
                echo "<font color='red'>get user error</font>";
            }
        }
        public function getReplyById($posts_id){
            $whereMap=array('theme_id'=>$posts_id);
            $reply=D('ReplyView');
            import('ORG.Util.Page');// 导入分页类
            $count=$reply->where($whereMap)->count();// 查询满足要求的总记录数 
            $page=new Page($count,4);// 实例化分页类 传入总记录数和每页显示的记录数 
            $show=$page->show();// 分页显示输出 
            $list=$reply->where($whereMap)->limit($page->firstRow.','.$page->listRows)->select();
            $res=array('list'=>$list,'page'=>$show,'count'=>$count);
            if($res){
               return $res;
            }else{
                echo "<font color='red'>get reply error</font>";exit();
            }
        }

}